<template>
  <div class="material-detail container-public">
    <div class="page-head">
      <Head></Head>
      <Mallhead></Mallhead>
    </div>
    <div class="detail-company">
      <div class="company-info">
        <div class="company-info-left">
          <div class="img"></div>
          <div>
            <div class="company-name">{{materialInfo.expirationName}}</div>
            <div class="company-area">主营产品：火锅底料、火锅蘸料</div>
          </div>
        </div>
        <div class="company-info-right">
          <i class="iconfont">&#xe69a;</i>
          <span>服务热线：13333333333</span>
        </div>
      </div>
    </div>
    <div class="detail-public">
      <div class="detil-info">
        <div class="main-img"></div>
        <div class="secondary-img">
          <div class="img"></div>
          <div class="img"></div>
          <div class="img"></div>
          <div class="img"></div>
        </div>
      </div>
      <div class="detail-left">
        <div class="title">{{materialInfo.title }} | {{ materialInfo.variety }} | {{ materialInfo.yearDate}}</div>
        <div class="price">
          <div class="label">价格</div>
          <div>
            <span class="color-main">¥</span>
            <span class="color-main unit-price">{{ materialInfo.unitPrice }}元</span>
            <span>/吨</span>
          </div>
        </div>
        <div class="tradable">
          <div class="label">可售</div>
          <div>{{materialInfo.tradableTotal}}吨</div>
        </div>
        <div>
          <el-button type="success">成功按钮</el-button>
          <el-button type="success" plain>成功按钮</el-button>
        </div>
      </div>
    </div>
    <div class="detail-recommend">
      <div class="recommend-title">商家推荐</div>
      <div class="recommend-items">
        <div class="recommend-item">
          <div class="img"></div>
          <div class="name">干辣椒中辣农家干红海椒灯笼椒商用火锅底料调味干辣椒</div>
        </div>
        <div class="recommend-item">
          <div class="img"></div>
          <div class="name">干辣椒中辣农家干红海椒灯笼椒商用火锅底料调味干辣椒</div>
        </div>
        <div class="recommend-item">
          <div class="img"></div>
          <div class="name">干辣椒中辣农家干红海椒灯笼椒商用火锅底料调味干辣椒</div>
        </div>
        <div class="recommend-item">
          <div class="img"></div>
          <div class="name">干辣椒中辣农家干红海椒灯笼椒商用火锅底料调味干辣椒</div>
        </div>
        <div class="recommend-item">
          <div class="img"></div>
          <div class="name">干辣椒中辣农家干红海椒灯笼椒商用火锅底料调味干辣椒</div>
        </div>
      </div>
    </div>
    <div class="detail-section">
      <div class="detail-company-info">
        <div class="name">{{materialInfo.expirationName}}</div>
        <div class="content">
          <div class="info-line">
            <i class="iconfont">&#xe693;</i>
            <div class="value">资质已认证</div>
          </div>
          <div class="info-line">
            <div class="label">联系人:</div>
            <div class="value">{{materialInfo.linkMan}}</div>
          </div>
          <div class="info-line">
            <div class="label">手机号码:</div>
            <div class="value">{{materialInfo.phone}}</div>
          </div>
          <div class="info-line">
            <div class="label">固定电话:</div>
            <div class="value">023-4567822</div>
          </div>
          <div class="info-line">
            <div class="label">所在地区:</div>
            <div class="value">重庆,江津</div>
          </div>
          <div class="info-line">
            <div class="label">主营产品:</div>
            <div class="value">火锅底料、火锅蘸料</div>
          </div>
          <div class="enter-store">进店逛逛</div>
        </div>
      </div>
      <div class="detail-main">
        <el-tabs v-model="activeName" type="card">
          <el-tab-pane label="商品参数" name="first"></el-tab-pane>
          <el-tab-pane label="商品详情" name="second"></el-tab-pane>
          <el-tab-pane label="联系方式" name="third"></el-tab-pane>
        </el-tabs>
        <div class="main-section">
          <div class="list">
            <div class="item">
              <span>大类：</span>
              <span>{{materialInfo.bigCategory}}</span>
            </div>
            <div class="item">
              <span>小类：</span>
              <span>{{materialInfo.smallCategory}}</span>
            </div>
            <div class="item">
              <span>品种：</span>
              <span>{{materialInfo.variety}}</span>
            </div>
            <div class="item">
              <span>年份：</span>
              <span>{{materialInfo.yearDate}}</span>
            </div>
            <div class="item">
              <span>产地：</span>
              <span>{{materialInfo.producingArea}}</span>
            </div>
            <div class="item">
              <span>库存地：</span>
              <span>{{materialInfo.inventoryPlace}}</span>
            </div>
          </div>
          <div class="product-info">
            <div class="section-title">
              <h1 class="title-main">商品详情</h1>
              <p class="title-tips">Product details</p>
            </div>
            <div class="img" v-for="(url, index) in materialInfo.goodsPicArray" :key="index">
              <el-image :src="url" fit="contain" style="width: 100%"></el-image>
            </div>
            <div class="section-title">
              <h1 class="title-main">联系方式</h1>
              <p class="title-tips">Contact information</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { intMaterialInfo } from "@/api/mall/Materials";
export default {
  name: "MaterialsDetail",
  data() {
    return {
      typeOptions: {
        '0': '普通',
        '1': '企业',
        '2': '个人'
      },
      materialInfo: {},
      activeName: 'first'
    };
  },
  mounted() {
    this._intMaterialInfo()
  },
  methods: {
    // 获取原材料采购详细信息
    async _intMaterialInfo() {
      if (!this.$route.params.id) return
      const res = await intMaterialInfo(this.$route.params.id)
      if (res.code === 200) {
        this.materialInfo = res.data
      }
    },
  },
};
</script>
<style scoped lang="scss">
@import "@/style/color.scss";
.detail-company {
  background: $greenColor;
  .company-info {
    width: $bigWidth;
    height: 120px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #FFFFFF;
    .company-info-left,
    .company-info-right {
      display: flex;
      align-items: center;
    }
    .img {
      width: 60px;
      height: 60px;
      border-radius: 30px;
      background: #fff;
      margin-right: 15px;
    }
    .company-name {
      font-size: 22px;
      font-weight: bold;
      margin-bottom: 10px;
    }
    i {
      margin-right: 4px;
    }
  }
}
.detail-public {
  width: $bigWidth;
  background-color: #fff;
  padding: 30px;
  margin: 0 auto;
  display: flex;
  .detil-info {
    margin-right: 30px;
    .main-img {
      width: 350px;
      height: 350px;
      background: $bgColor;
    }
    .secondary-img {
      display: flex;
      .img {
        width: 80px;
        height: 80px;
        background: $bgColor;
        margin-top: 10px;
        margin-right: 10px;
      }
      .img:last-child {
        margin-right: 0;
      }
    }
  }
  .detail-left {
    width: 560px;
    color: #333;
    .title {
      font-size: 24px;
      font-weight: bold;
      margin-bottom: 20px;
    }
    .price,
    .tradable {
      height: 100px;
      background: rgba(19,194,40,0.2);
      display: flex;
      align-items: center;
      .label {
        width: 60px;
        padding: 0 10px;
      }
      .color-main {
        color: $greenColor;
      }
      .unit-price {
        font-size: 18px;
        font-weight: 600;
      }
    }
    .tradable {
      height: 45px;
      background: rgba(19,194,40,0.1);
      margin-bottom: 40px;
    }
  }
}
.detail-recommend {
  width: $bigWidth;
  background-color: #fff;
  padding: 30px;
  margin: 20px auto 0;
  .recommend-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
  }
  .recommend-items {
    display: flex;
    .recommend-item {
      width: 208px;
      margin-right: 20px;
      .img {
        width: 208px;
        height: 208px;
        background: $bgColor;
        margin-bottom: 14px;
      }
      .name {
        color: #999;
      }
    }
    .recommend-item:last-child {
      margin-right: 0;
    }
  }
}
.detail-section {
  width: $bigWidth;
  margin: 20px auto 0;
  display: flex;
  justify-content: space-between;
  .detail-company-info {
    width: 240px;
    .name {
      height: 50px;
      padding: 0 20px;
      font-size: 14px;
      color: #222222;
      line-height: 50px;
      background: #FAFAFA;
    }
    .content {
      padding: 10px 20px;
      background: #FFF;
      .info-line {
        height: 30px;
        display: flex;
        align-items: center;
        .iconfont {
          color: $yellowColor;
        }
        .label {
          flex-shrink: 0;
          width: 60px;
          margin-right: 10px;
          text-align-last: justify;
        }
      }
      .enter-store {
        height: 40px;
        color: $greenColor;
        text-align: center;
        line-height: 40px;
        border: 1px solid $greenColor;
        margin: 10px 0;
        cursor: pointer;
      }
    }
  }
  .detail-main {
    width: 940px;
    background: #fff;
    ::v-deep .el-tabs__item.is-active {
      background: $greenColor;
      color: #fff !important;
    }
    ::v-deep .el-tabs__item:hover {
      color: $greenColor;
    }
  }
  .main-section {
    padding: 30px 60px 60px;
    .list {
      display: flex;
      flex-wrap: wrap;
      padding-bottom: 20px;
      border-bottom: 1px solid #EEE;
      .item {
        width: 33.3%;
        line-height: 30px;
      }
    }
    .product-info {
      .section-title {
        margin-top: 50px;
      }
      .img {
        width: 100%;
        padding-bottom: 50px;
        border-bottom: 1px solid #EEE;
      }
    }
  }
}
</style>
